<?php
#
# author: Phil Spagnolo
# (c)2008 South Hill Calvary Chapel
#

$linkList = array("sermon.php", "podcast.php");
$textList = array("Archived Sermons", "Podcasts");

include_once("./root.inc.php");
include("${root}/mysql/database_info.php");
include("${root}/common.php");
include("${root}/mysql/common.php");

$table = "sermons";
connect_select_test($table);

$title = "Most Recent Sermons";
$meta_key= 'sermons, teaching, Bible, God, Jesus, Word, Old Testament, New Testament, recent, scripture';
$meta_desc="The most recent Bible teachings at South Hill Calvary Chapel.";
print_html_head($title ,$meta_key,$meta_desc);

print_java_head(NULL);
begin_body();
page_title($title);

//MAIN SERVICES
in_page_link(2, false, $linkList, $textList, "");

printf("<div><h4><a href='./sermon.php?service=Sunday'>Sunday Service</a></h4></div>\n");
$query="SELECT * FROM $table WHERE service='Sunday' ORDER BY date DESC";
$result=mysql_query($query) or die (mysql_error());
sermon_table($result,4,$table);

Printf("</div>\n\n");
printf("<div class='content'>\n");

printf("<div><h4><a href='./sermon.php?service=Wednesday'>Wednesday Service</a></h4></div>\n");
$query="SELECT * FROM $table WHERE service='Wednesday' ORDER BY date DESC";
$result=mysql_query($query) or die (mysql_error());
sermon_table($result,4,$table);

Printf("</div>\n\n");
printf("<div class='content'>\n");

printf("<div><h4><a href='./sermon.php?service=%s'>High Shcool</a></h4></div>\n", "High%20School");
$query="SELECT * FROM $table WHERE service='High School' ORDER BY date DESC";
$result=mysql_query($query) or die (mysql_error());
sermon_table($result,4,$table);

Printf("</div>\n\n");
printf("<div class='content'>\n");

printf("<div><h4><a href='./sermon.php?service=Jr+High'>Jr High Service</a></h4></div>\n");
$query="SELECT * FROM $table WHERE service='Jr High' ORDER BY date DESC";
$result=mysql_query($query) or die (mysql_error());
sermon_table($result,4,$table);

Printf("</div>\n\n");
printf("<div class='content'>\n");

printf("<div><h4><a href='./sermon.php?service=Retreat'>Retreats</a></h4></div>\n");
$query="SELECT * FROM $table WHERE service='Retreat' ORDER BY date DESC";
$result=mysql_query($query) or die (mysql_error());
sermon_table($result,4,$table);
//Close the database
mysql_close();

in_page_link(2, false, $linkList, $textList, "");

end_page_title();
end_body();
?>
